﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Service
{
    public partial interface IRepository<TEntity> where TEntity : class
    {

        /// <summary>
        /// 根据id获取
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        TEntity GetById(object id);

        /// <summary>
        /// 列表
        /// </summary>
        /// <returns></returns>
        IQueryable<TEntity> Table { get; }

        /// <summary>
        /// 实体插入
        /// </summary>
        /// <param name="entity"></param>
        void Insert(TEntity entity);
        void Insert(IEnumerable<TEntity> entities);

        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="entity"></param>
        void Update(TEntity entity);

        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="entity"></param>
        void Delete(TEntity entity);
    }
}
